home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
daemonize.z
/
daemonize
Wrap
Text File
|
1998-10-20
|
3KB
|
67 lines
DDDDAAAAEEEEMMMMOOOONNNNIIIIZZZZEEEE((((3333)))) DDDDAAAAEEEEMMMMOOOONNNNIIIIZZZZEEEE((((3333))))
NNNNAAAAMMMMEEEE
_daemonize - make a process into a daemon
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<uuuunnnniiiissssttttdddd....hhhh>>>>
iiiinnnntttt ____ddddaaaaeeeemmmmoooonnnniiiizzzzeeee((((iiiinnnntttt ffffllllaaaaggggssss,,,, iiiinnnntttt ffffdddd1111,,,, iiiinnnntttt ffffdddd2222,,,, iiiinnnntttt ffffdddd3333))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The __d_a_e_m_o_n_i_z_e function does the common work needed ``to put a function
into the background,'' or to make it into a ``daemon.'' That generally
includes forking a new process, closing most files, and releasing the
controlling tty.
If ffffllllaaaaggggssss &&&& ____DDDDFFFF____NNNNOOOOFFFFOOOORRRRKKKK is 0, then a new process in a new session is
started. Debugging is often easier with ffffllllaaaaggggssss set to contain ____DDDDFFFF____NNNNOOOOFFFFOOOORRRRKKKK.
If ffffllllaaaaggggssss &&&& ____DDDDFFFF____NNNNOOOOCCCCHHHHDDDDIIIIRRRR is 0, then the current working directory is
changed to /. Otherwise, the current working directory is unchanged.
If ffffllllaaaaggggssss &&&& ____DDDDFFFF____NNNNOOOOCCCCLLLLOOOOSSSSEEEE is 0, then all file descriptors except ffffdddd1111, ffffdddd2222,
and ffffdddd3333 are closed. Because __d_a_e_m_o_n_i_z_e closes all file descriptors,
_c_l_o_s_e_l_o_g() is called to stop logging cleanly. The ffffdddd# arguments should
be -1 if they are not file descriptors to be left open.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
close(2), chdir(2), fork(2), getdtablesize(2), syslog(3B), setsid(2),
tty(1), tty(7)
DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
The returned value -1 indicates that one of the necessary system calls
failed.
PPPPaaaaggggeeee 1111